package com.hinnotek.amoeba.adapters.old

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.bean.old.AmibaProjectListByOrgIdBean

class PaymentRequestAdapter :
    BaseQuickAdapter<AmibaProjectListByOrgIdBean, BaseViewHolder>(R.layout.item_payment_request) {
    override fun convert(holder: BaseViewHolder, item: AmibaProjectListByOrgIdBean) {
        holder.setText(R.id.tv_payment_type, if (item.amibaPayType == 1) "产品" else "项目")
        if (item.amibaPayType == 1) {
            holder.setText(R.id.tv_payment_project, item.provideProjectName)
        } else {
            holder.setText(R.id.tv_payment_project, item.projectName)
        }
        holder.setText(R.id.tv_payment_price, item.payTotal)
        when (item.approvalState) {
            1 -> {
                holder.setText(R.id.tv_status, "已申请")
                holder.setTextColor(R.id.tv_status, ContextCompat.getColor(context,R.color.black))
            }
            2 -> {
                holder.setText(R.id.tv_status, "已同意")
                holder.setTextColor(
                    R.id.tv_status,
                    ContextCompat.getColor(context,R.color.xui_btn_green_normal_color)
                )
            }
            3 -> {
                holder.setText(R.id.tv_status, "已拒绝")
                holder.setTextColor(
                    R.id.tv_status,
                    ContextCompat.getColor(context,R.color.xui_config_color_red)
                )

            }
        }
    }
}